package com.yunhai.ucenter.controller;

import com.yunhai.common.dto.Ret;
import com.yunhai.model.vo.ums.AccountPasswordVo;
import com.yunhai.model.vo.ums.UserInfoVo;
import com.yunhai.ucenter.service.SysUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/auth")
@RestController
public class LoginController {

    @Resource
    private SysUserService sysUserService;

    @PostMapping("")
    public Ret loginByUsername(@RequestBody AccountPasswordVo accountPasswordVo) throws Exception {

        UserInfoVo userInfoVo = sysUserService.loginByUsername(accountPasswordVo);
        return Ret.ok(userInfoVo);
    }
}
